package com.msb;

import java.util.concurrent.TimeUnit;

/**
 * @author lidexin
 * @create 2021-09-18 21:29
 */
public class T01_WhatIsThread {
    private static class T1 extends Thread {
        @Override
        public void run() {
            for (int i = 0; i < 10; i++) {
                try {
                    TimeUnit.MICROSECONDS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("T1");
            }
        }
    }

    public static void main(String[] args) {
        //方法调用，T1、main顺序执行
        new T1().run();
//        new T1().start();//T1、main交替输出
        for(int i=0;i< 10;i++) {
            try {
                TimeUnit.MICROSECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("main");
        }
    }
}
